#ifndef _SERIAL_H
#define _SERIAL_H
#include <stdint.h>

enum
{
	STATE_RECV_HEAD,
	STATE_RECV_LEN,
	STATE_RECV_CMD,
	STATE_RECV_DATA,
	STATE_RECV_CHECKSUM,
};

typedef struct
{
	uint8_t status;
	uint8_t length;
	uint8_t cmd;
	uint8_t idx;
	uint8_t data[64];
	uint8_t checksum;
} SerialData_t;

typedef struct
{
	int16_t PosA;
	int16_t PosB;
	int16_t Speed;
	uint32_t Tick;
	uint32_t Delay;
	uint32_t RemainDelay;
	uint32_t flag;
	uint32_t pi_up;
	uint32_t pi_dn;
    uint32_t backlash_flag;
    int16_t backlash_pi_high_pos;
    int16_t backlash_pi_low_pos;
} MotorTask_t;

#endif
